﻿using System;

namespace Server
{
  class TDataProcessor : TRequestProcessor
  {
    private static void InitClient(Server.Records.TClient Client)
    {
      Client.BirthDate            = DateTime.Now;
      Client.ClientName           = "Client name";
      Client.EffectiveDate        = DateTime.Now.AddDays(10);
      Client.Fees                 = "50"; // use currency data field!
      Client.FirstName            = "Client first name";
      Client.Gender               = "male";
      Client.InitDate             = DateTime.Now.AddHours(5);
      Client.InsuranceCompany     = "insurance company";
      Client.LastName             = "Client last name";
      Client.MatrialStatus        = "Divorced";
      Client.MiddleName           = "Client middle name";
      Client.ModifiedDate         = DateTime.Now;
      Client.PolicyCost           = "1000";
      Client.PolicyNumber         = "UNASSIGNED";
      Client.Suffix               = "";
      Client.TotalPolicyCost      = "1050";      
    }

    protected override void ProcessRequest(object Param)
    {
      Server.Records.TClient Client = new Records.TClient();
      InitClient(Client);
      System.Text.StringBuilder Builder = new System.Text.StringBuilder();
      Client.ToJSON(Builder);
      base.Output(Encoding.GetBytes(Builder.ToString()));
    }
  }
}
